#include <QApplication>
#include <QTextCodec>
#include <QFont>
#include <QIcon>
#include <QFontDatabase>

#include "mainwindow.h"
#include "config.h"

int main(int argc, char *argv[])
{
    QTextCodec* codec = QTextCodec::codecForName("UTF-8");
    QTextCodec::setCodecForLocale(codec);

    QApplication::setApplicationVersion(QString(VERSION_STR));
    QApplication::setApplicationName(APPLICATION_NAME);

    QApplication a(argc, argv);
    a.setWindowIcon(QIcon(":/icons/logo.png"));

    {
        int fontid = QFontDatabase::addApplicationFont(":/font/SourceCodePro-Regular.ttf");
        if (fontid >= 0) {
            QStringList font_families = QFontDatabase::applicationFontFamilies(fontid);
            if (!font_families.isEmpty()) {
                a.setFont(font_families.at(0));
            }
        }
    }

    MainWindow w;
    w.setWindowTitle(QApplication::applicationName());
    w.resize(1200, 800);
    w.show();

    return a.exec();
}
